package net.butfly.bus;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

@SuppressWarnings("unchecked")
public class Response implements Serializable {
	private static final long serialVersionUID = 5897857767191140750L;

	private Object result = null;
	private Map<String, Object> context = new HashMap<String, Object>();
	private Error error = null;

	public Object getResult() {
		return result;
	}

	public void setResult(Object result) {
		this.result = result;
	}

	public <T> T get(String key) {
		return (T) this.context.get(key);
	}

	public <T> T put(String key, T value) {
		T result = (T) this.context.get(key);
		this.context.put(key, value);
		return result;
	}

	public Error getError() {
		return error;
	}

	public void setError(Error error) {
		this.error = error;
	}
}
